class Person:
    def __init__(self, name, weight, height, sex):
        self.name = name
        self.weight = weight
        self.height = height
        self.sex = sex

    @property
    def BMI(self):
        if self.sex == '男':
            return (self.height - 80) * 0.7
        elif self.sex == '女':
            return (self.height - 70) * 0.6
        else:
            return '性别输入错误'


P1 = Person('ali', 102, 163, '女')
print(P1.name)
P1.name = 'soffy'
print(P1.name)
print(P1.BMI)
